<?php
    $this->assign('title','Contas');
    $this->assign('page_local','Contas');
    $this->assign('page_now','listagem');
    $this->assign('panel_title','Contas');
    $this->start('content_filter');
    echo $this->Search->create('',array('class'=>'form-inline'));
?>
    <div class="form-group">
        <?php
            echo $this->Search->input('filter1',array('class'=>'form-control','placeholder'=>'Conta','autocomplete'=>'off'));
        ?>
    </div>
<?php
    echo $this->Search->button('Filtro',array('class'=>'btn btn-primary'));
    echo $this->Search->end();

    $this->end();
    $this->start('content_table');
    if(!empty($accounts)):
        ?>
        <thead>
        <tr>
            <th colspan="4"><strong>Saldo Consolidado: R$ </strong><?php echo $saldoConsolidado ?></th>
        </tr>
        <tr>
            <th>Nome</th>
            <th>Descrição</th>
            <th>Saldo Atual</th>
            <th class="col-sm-1 text-center">#</th>
        </tr>
        </thead>
        <tbody>
        <?php foreach ($accounts as $account): ?>
            <tr>
                <td><?php echo h($account['Account']['name']); ?>&nbsp;</td>
                <td><?php echo h($account['Account']['descricao']); ?>&nbsp;</td>
                <td><?php echo h($this->Func->money($account['Account']['valor'])); ?>&nbsp;</td>
                <td class="table-action">
                    <?php echo $this->Html->link('<i class="fa fa-eye"></i>', array('action' => 'view', $account['Account']['id']),array("data-placement"=>"top","data-toggle"=>"tooltip","class"=>"tooltips",'escape'=>false,"title"=>"","data-original-title"=>"Ver Registro")); ?>

                    <?php echo $this->Html->link('<i class="fa fa-pencil"></i>', array('action' => 'edit', $account['Account']['id']),array("data-placement"=>"top","data-toggle"=>"tooltip","class"=>"tooltips",'escape'=>false,"title"=>"","data-original-title"=>"Editar Registro")); ?>

                    <?php echo $this->Form->postLink('<i class="fa fa-trash-o"></i>', array('action' => 'delete', $account['Account']['id']), array('escape'=>false,"title"=>"","data-original-title"=>"Deletar Registro","data-placement"=>"top","data-toggle"=>"tooltip","class"=>"tooltips"), __('Deseja realmente excluir o registro # %s?', $account['Account']['name'])); ?>
                </td>
            </tr>
        <?php endforeach; ?>
        </tbody>
        <?php
    else:
        echo $this->Func->showMessage("Nenhum resultado foi encontrado em nossa base!",array('type'=>'info','close'=>false));
    endif;
    $this->end();
?>